
module.exports = function ($scope, $state, $stateParams,$resource,FileUploader,toaster,$modal) {
  $scope.strs = $stateParams.directory_pdf;
  $scope.type = $stateParams.type;
  $scope.id = $stateParams.id;
  console.log($scope.type);
  console.log($scope.strs);
  console.log($scope.id);
  $('#dlq').media({width:800, height:600,autoplay: true, src: $scope.strs}); 
  
  $scope.pass = function() {
    if ($scope.type == '0') {
      var url = '/api/as/ggc/reviewGuide/updateDirsUp';
    } else if ($scope.type == '1') {
      var url = '/api/as/ggc/reviewGuide/updateDirssUp';
    } else if ($scope.type == '2') {
      var url = '/api/as/ggc/reviewGuide/updateDirLeaUp';
    }
    if (confirm('确定要通过吗?')){
        $resource(url, {}, {}).
        save({'id':$scope.id},function(res) {
          if (res.errcode != 0) {
            toaster.error({title:"通过失败",body:res.errmsg});
            return;
          } 
            toaster.success({title:"同意成功",body:'已同意'});
            $state.go('app.planning_department_affirmation', {'type' : '1'});
        });
    }
  }
  $scope.back= function () {
    $scope.flag = 'tuihui'
    $scope.info = {
      'id' : $scope.id
    }
    var modalInstance = $modal.open({
      template: require('../views/reject_notice.html'),
      controller: 'reject_notice',
      size: 'xs',
      resolve: {
        info: function () {
          return $scope.info;
        },
        flag: function () {
          return $scope.flag;
        }
      }
    });
    modalInstance.result.then(function() {
      $state.go('app.planning_department_affirmation', {'type' : '1'});
    });
  }
};
